import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path: '/',
    name: 'third',
    component: () => import('@/views/third')
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('@/views/index')
  },
  {
    path: '/add',
    name: 'add',
    component: () => import('@/views/add')
  },
  {
    path: '/pending/:id',
    name: 'pending',
    component: () => import('@/views/pending')
  },
  {
    path: '/file',
    name: 'file',
    component: () => import('@/views/file')
  },
  {
    path: '/photo',
    name: 'photo',
    component: () => import('@/views/photo')
  },
  {
    path: '/new',
    name: 'new',
    component: () => import('@/views/new')
  },
  {
    path: '/devicelist/:type',
    name: 'devicelist',
    component: () => import('@/views/devicelist')
  },
  {
    path: '/AddDevice/:type',
    name: 'AddDevice',
    component: () => import('@/views/AddDevice')
  }
]

const router = new VueRouter({
  mode: 'hash',
  routes
})

export default router
